/*
    SUSAN® - Sole of Unix Save ANything

   
      Copyright (C) 2011-2016 Skyatlas Co. LTD

   

   
*/

#ifndef BAREOS_LIB_RECENT_JOB_RESULTS_LIST_H
#define BAREOS_LIB_RECENT_JOB_RESULTS_LIST_H

namespace RecentJobResultsList {

struct JobResult {
  // !! this plain data structure will be written to a file
  char pad[16]{0};
  int32_t Errors = 0;  // FD/SD errors
  int32_t JobType = 0;
  int32_t JobStatus = 0;
  int32_t JobLevel = 0;
  uint32_t JobId = 0;
  uint32_t VolSessionId = 0;
  uint32_t VolSessionTime = 0;
  uint32_t JobFiles = 0;
  uint64_t JobBytes = 0;
  utime_t start_time = 0;
  utime_t end_time = 0;
  char Job[MAX_NAME_LENGTH]{0};
};

void Append(JobControlRecord* jcr);

std::vector<RecentJobResultsList::JobResult> Get();
RecentJobResultsList::JobResult GetMostRecentJobResult();
std::size_t Count();
bool IsEmpty();

bool ExportToFile(std::ofstream& f);
bool ImportFromFile(std::ifstream& f);

void Cleanup();

}  // namespace RecentJobResultsList


#endif  // BAREOS_LIB_RECENT_JOB_RESULTS_LIST_H
